#ifndef AED_TRIGGER_H
#define AED_TRIGGER_H

#include <QString>
#include <QList>
#include <QDebug>
#include "aed_script.h"
class AED_Trigger
{
public:
    struct Condition{
        QString type;
        QString name;

        Condition(const QString &t, const QString &n){type = t;name=n;}
        Condition(const Condition &cond){type=cond.type;name=cond.name;}
        Condition &operator=(const Condition &cond){type=cond.type;name=cond.name; return *this;}
        bool operator==(const Condition &cond){if(name==cond.name && type == cond.type) return true; return false;}
    };

private:
    AED_Script *m_script;
    QList<Condition> m_conditions;
public:
    AED_Trigger();
    AED_Trigger(const AED_Trigger &trig);

    AED_Trigger &operator=(const AED_Trigger &trig);
    bool operator==(const AED_Trigger &trig){if(m_script==trig.m_script&&m_conditions==trig.m_conditions)return true; return false;}
    AED_Script* GetScript(){return m_script;}
    void SetScript(AED_Script *script){m_script=script; }

    QList<Condition>* GetConditions(){return &m_conditions;}
    const QList<Condition>* GetConditions()const{return &m_conditions;}
    void AddCondition(const QString &t, const QString &n){m_conditions.append(Condition(t,n));}
    void DeleteCondition(int index){m_conditions.removeOne(m_conditions[index]);}
};

#endif // AED_TRIGGER_H
